import React, { useRef } from 'react'

export default function UseRef() {
    const h1Ref = useRef();
    const changeValue = () => {
        if (h1Ref.current) {
            h1Ref.current.textContent = '我成功了'
        }
    }
    return (
        <div>
            <h1 ref={h1Ref}>UseRef</h1>
            <button onClick={changeValue}>UseRef</button>
        </div>
    )
}
